<template>
  <BasicTable
    @register="registerTable"
    @edit-change="handleEditChange"
    @selection-change="selectionChange"
    :modal="setModalRef"
  >
    <template #bodyCell="{ column, record }">
      <template v-if="column.key === 'isFree'">
        <!-- <TableAction :actions="createActions(record)" /> -->
        {{ record.isFree == 1 ? '空闲' : '在途' }}
      </template>
    </template>
  </BasicTable>
</template>
<script lang="ts" setup>
  import {} from 'ant-design-vue';
  import { BasicTable, useTable } from '@/components/Table';
  import { getDriverInfoAPI } from '@/api/eslogis-tps/index';

  const columns = [
    {
      title: '姓名',
      dataIndex: 'name',
    },
    {
      title: '执照',
      dataIndex: 'dl',
    },
    {
      title: '常用车辆',
      dataIndex: 'licensePlate',
    },
    {
      title: '车牌',
      dataIndex: 'licensePlate',
    },
    {
      title: '驾龄',
      dataIndex: 'driveAge',
    },
    {
      title: '保险',
      dataIndex: 'productBrandId',
    },
    {
      title: '最大载重量',
      dataIndex: 'loadNumber',
    },
    {
      title: '车型',
      dataIndex: 'spec',
    },
    {
      title: '状态',
      dataIndex: 'isFree',
    },
  ];
  const [registerTable] = useTable({
    columns: columns,
    showIndexColumn: false,
    api: getDriverInfoAPI,
    beforeFetch: (params) => {
      return { carrierMid: data.mid2, ...params };
    },

    scroll: { y: '100%' },
    pagination: true,
    showTableSetting: false,
    showSelectionBar: false, // 显示多选状态栏
  });
  // 获取外部传入的数据
  const { data } = defineProps({
    data: {
      type: Array,
      default: () => {
        return {};
      },
    },
  });
  console.log(data);
</script>

<style scoped></style>
